import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
from chat.signals import work_done
from chat.consumers import signal_receiver
import time
# There are two ways you can connect a receiver to a signal. You can take the manual connect route:
# work_done.connect(signal_receiver)
# or use a receiver() decorator:
# @receiver(request_finished)
# def my_callback(sender, **kwargs):
#     print("Request finished!")

while True:
    time.sleep(5)
    print('send message')
    work_done.send("Hello", message='Hello')

# # import channels.layers
# # channel_layer = channels.layers.get_channel_layer()
# # from asgiref.sync import async_to_sync
# # async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})
# # async_to_sync(channel_layer.receive)('test_channel')
# # # {'type': 'hello'}